package pageProcessor;

import java.io.IOException;
import java.io.InputStream;

public class MyInputStreamReader extends Thread {

    private InputStream is;
    private String text;

    public MyInputStreamReader(InputStream is) {
        this.is = is;
        start();
    }

    public String getText() {
        return text;
    }

    @Override
    public void run() {
        StringBuilder sb = new StringBuilder(64);
        int value = -1;
        try {
            while ((value = is.read()) != -1) {
                sb.append((char)value);
            }
        } catch (IOException exp) {
            exp.printStackTrace();
            sb.append(exp.getMessage());
        }
        text = sb.toString();
    }

}
